/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.alxbrendmaquinarias.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Max
 */
@Entity
@Table(name = "account_for_pay", catalog = "sgcom", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AccountForPay.findAll", query = "SELECT a FROM AccountForPay a"),
    @NamedQuery(name = "AccountForPay.findById", query = "SELECT a FROM AccountForPay a WHERE a.id = :id"),
    @NamedQuery(name = "AccountForPay.findByAmount", query = "SELECT a FROM AccountForPay a WHERE a.amount = :amount"),
    @NamedQuery(name = "AccountForPay.findByEndDatePay", query = "SELECT a FROM AccountForPay a WHERE a.endDatePay = :endDatePay"),
    @NamedQuery(name = "AccountForPay.findByTypeMoney", query = "SELECT a FROM AccountForPay a WHERE a.typeMoney = :typeMoney"),
    @NamedQuery(name = "AccountForPay.findByState", query = "SELECT a FROM AccountForPay a WHERE a.state = :state")})
public class AccountForPay implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "amount")
    private Double amount;
    @Column(name = "end_date_pay")
    @Temporal(TemporalType.DATE)
    private Date endDatePay;
    @Size(max = 20)
    @Column(name = "type_money")
    private String typeMoney;
    @Size(max = 45)
    @Column(name = "state")
    private String state;
    @JoinColumn(name = "input_document_id", referencedColumnName = "id")
    @ManyToOne
    private InputDocument inputDocumentId;
    @OneToMany(mappedBy = "accountForPayId")
    private List<HistoryPay> historyPayList;

    public AccountForPay() {
    }

    public AccountForPay(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Date getEndDatePay() {
        return endDatePay;
    }

    public void setEndDatePay(Date endDatePay) {
        this.endDatePay = endDatePay;
    }

    public String getTypeMoney() {
        return typeMoney;
    }

    public void setTypeMoney(String typeMoney) {
        this.typeMoney = typeMoney;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public InputDocument getInputDocumentId() {
        return inputDocumentId;
    }

    public void setInputDocumentId(InputDocument inputDocumentId) {
        this.inputDocumentId = inputDocumentId;
    }

    @XmlTransient
    public List<HistoryPay> getHistoryPayList() {
        return historyPayList;
    }

    public void setHistoryPayList(List<HistoryPay> historyPayList) {
        this.historyPayList = historyPayList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AccountForPay)) {
            return false;
        }
        AccountForPay other = (AccountForPay) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.alxbrendmaquinarias.model.AccountForPay[ id=" + id + " ]";
    }
    
}
